<template>
  <el-dialog v-if="dialogFileUpload" title="上传文件资料" :visible.sync="dialogFileUpload" fullscreen>
    <el-form ref="refForm" :model="fileForm" label-width="80px">
      <el-form-item label="名称" prop="fileName" width="200px">
        <el-input v-model="fileForm.fileName" />
      </el-form-item>
      <el-form-item label="类型" prop="fileType">
        <el-select v-model="fileForm.fileType">
          <el-option
            v-for="(item, index) in fileTypeArray"
            :key="index"
            :value="item.value"
            :label="item.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="上传文件" prop="fileType">
        <el-upload
          :data="fileData"
          class="upload-demo"
          action="#"
          drag
          :before-upload="beforeUpload"
          :http-request="noticeUpload"
          :file-list="list"
          :auto-upload="false"
        >
          <i class="el-icon-upload" />
          <div class="el-upload__text">
            将文件拖到此处，或
            <em>点击上传</em>
          </div>
        </el-upload>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="submitUpload(fileForm)">点击上传</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
export default {
  name: 'Upload',
  components: {},
  props: {
    dialogFileUpload: { type: Boolean, default: false }
  },
  data: () => ({
    fileForm: {},
    fileTypeArray: [],
    fileList: [],
    fileData: null
  }),
  methods: {}
}
</script>
